home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-21 | 4.1 KB | 151 lines | [TEXT/ttxt] |
- --<<<
- -- Filename:
- -- myCtrans.sx
-
- -- Purpose:
- -- This file defines a cast translator that
- -- prints information about castmembers in a Director file
- -- to an output file
-
-
- -- Specialized Classes:
- -- CastTwoDShape, CastTextPresenter, CastMoviePlayer,
- -- and CastDigitalAudioPlayer are subclasses of TwoDShape,
- -- TextPresenter, InterleavedMoviePlayer, and DigitalAudioPlayer
- -- respectively. The only thing that is different between the
- -- new subclass and its superclass is that the new subclasses
- -- each have a name instance variable.
- -- We use the name instance variable to hold the castName
- -- of a castmember in a Director castlist.
-
- -- The main specialized class is CastToInfoTranslator
- -- which defines the translation methods to translate
- -- Director castmembers when importing into ScriptX.
-
- -- When you create an instance of CastToInfoTranslator,
- -- you must:
- -- set the shapeClass iv to CastTwoDShape
- -- set the textClass iv to CastTexPresenter
- -- set the bitmapClass iv to CastTwoDShape
- -- set the videoClass iv to CastMoviePlayer
-
-
-
- -- Instructions to User:
- -- Don't load this file directly.
- -- Instead, load converter.sx, which loads this file.
- -- converter.sx creates an instance of CastToInfoTranslator
- -- and sets its ivs appropriately, then uses it to import
- -- a cast list from a Director file
-
- -- Author:
- -- Jocelyn Becker
-
-
-
-
-
-
- in Module myModule
-
- class CastTwoDShape (TwoDShape)
- instance variables
- name
- end
-
- class CastTextPresenter (TextPresenter)
- instance variables
- name
- end
-
- class CastMoviePlayer (InterleavedMoviePlayer)
- instance variables
- name
- end
-
- class CastDigitalAudioPlayer (DigitalAudioPlayer)
- instance variables
- name
- end
-
- class CastToInfoTranslator (DTKCastMemberToAudioStream, DTKCastMemberToPresenter)
- end
-
- -- for the CastMemberToInfo translator, need to set the following ivs:
- -- bitmapClass := castTwoDShape
- -- shapeClass := castTwoDShape
- -- textClass := CastTextPresenter
- -- videoClass := CastMoviePlayer
-
-
- method translateShape self {class CastToInfoTranslator} shapeCast ->
- (
- local thePresenter := nextMethod self shapeCast
- thePresenter.name := shapeCast.castName
-
- format self.outputStream "\nCast member at position %1 is a shape named %2.
- It is being translated to a CastTwoDShape. \n" \
- #(shapeCast.castNumber, shapeCast.castName) #(@unadorned, @unadorned)
-
- -- return the presenter so that it is put in the cast list
- thePresenter
- )
-
-
- method translateBitMap self {class CastToInfoTranslator} bitmapCast ->
- (
- local thePresenter := nextMethod self bitmapCast
- thePresenter.name := bitmapCast.castName
-
- format self.outputStream "\nCast member at position %1 is a bitmap named %2.
- It is being translated to a CastTwoDShape. \n" \
- #(bitmapCast.castNumber, bitmapCast.castName) #(@unadorned, @unadorned)
-
- -- return the presenter so that it is put in the cast list
- thePresenter
- )
-
-
- method translateText self {class CastToInfoTranslator} textCast ->
- (
- local thePresenter := nextMethod self textCast
- thePresenter.name := textCast.castName
-
- format self.outputStream "\nCast member at position %1 is a text item named %2.
- It is being translated to a CastTextPresenter. \n" \
- #(textCast.castNumber, textCast.castName) #(@unadorned, @unadorned)
-
- -- return the presenter so that it is put in the cast list
- thePresenter
- )
-
-
- method translateVideo self {class CastToInfoTranslator} videoCast ->
- (
- local thePresenter := nextMethod self videoCast
- thePresenter.name := videoCast.castName
-
- format self.outputStream "\nCast member at position %1 is a video named %2.
- It is being translated to a CastMoviePlayer. \n" \
- #(videoCast.castNumber, videoCast.castName) #(@unadorned, @unadorned)
- -- return the presenter so that it is put in the cast list
- thePresenter
- )
-
-
- method translateSound self {class CastToInfoTranslator} soundCast ->
- (
- local theAudioStream := nextMethod self soundCast
- local thePlayer := new CastDigitalAudioPlayer mediaStream:theAudioStream
-
- format self.outputStream "\nCast member at position %1 is a sound named %2.
- It is being translated to a cast digital audio player. \n" \
- #(soundCast.castNumber, soundCast.castName) #(@unadorned, @unadorned)
-
- -- return the player so that it is put in the cast list
- thePlayer
- )
-
-
- -->>>
-